"""
input:
L = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 32768, 65536, 4294967296]
output:
{1: [1, 2, 4, 8],
 2: [16, 32, 64],
 3: [128, 256, 512],
 4: [1024],
 5: [32768, 65536],
 6: [4294967296]}
"""

import pprint


def f2(l, g):
    """
    l: 待遍历迭代器
    g: 分组数的列表
    """
    return {i + 1:
            list(map(lambda x: next(x), [iter(l)] * v))
            for i, v in enumerate(g)}


if __name__ == '__main__':
    L = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 32768, 65536, 4294967296]
    pprint.pprint(f2(iter(L), [4, 3, 3, 1, 2, 1]))
